<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.min.js"></script>
</head>

<body>
    <div id="app">
        <my-header></my-header>
        <web-msg></web-msg>
    </div>
</body>
<script>
    Vue.component(
        "my-header", {
            template: "<div><h1 @click='hello'>{{msg}}</h1></div>",
            data() {
                return {
                    msg: "这是my-header组件的数据部分"
                }
            },
            methods: {
                hello() {
                    alert("hello")
                }
            }
        }
    )
    var VM = new Vue({
        el: '#app',
        components: {
            "web-msg": {
                template: "<div><h1>{{msg1}}</h1><h1>{{msg2}}</h1></div>",
                data() {
                    return {
                        msg1: "第一条信息",
                        msg2: "第二条信息"
                    }
                }
            }
        },
        data: {},
        methods: {},
        watch: {},
    })
</script>

</html>